﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="ShowSanPham.aspx.cs" Inherits="WebBanThuoc.ShowSanPham" %>

<asp:Content ID="Content2" ContentPlaceHolderID="main" runat="server">
     <script type="text/javascript">
         $(document).ready(function () {
           var $chosen = <%=Request.QueryString["trang"] %>;
             $(".page").click(function () {
                 $(this).addClass("page_click");
             });
             $(".page").each(function () {
                 if ($(this).html() == $chosen) {
                     $(this).addClass("page_click");
                 }
             });


         });
       </script>
    <div class="tran_nav">
    <div itemscope itemtype="http://data-vocabulary.org/Breadcrumb" style="width:30px;display:inline;">
          <a href="TrangChu.aspx" itemprop="url" >
            <span itemprop="title">Trang chủ</span>
          </a> 
        </div> 
       <!-- <div itemscope itemtype="http://data-vocabulary.org/Breadcrumb" style="width:30px;  display:inline;">
          <a href="ShowSanPham.aspx?action=advSearch" itemprop="url">
            <span itemprop="title">Sản phẩm</span>
          </a> 
        </div> -->
        <div itemscope itemtype="http://data-vocabulary.org/Breadcrumb" style="width:30px; display:inline;">  
        <%if(Request.QueryString["action"]=="advSearch")
          {%>
            <%if (Request.QueryString["LSPChon"] != "0" && Request.QueryString["LSPChon"] != null)
              { %>
               <span itemprop="title"><%="<font>&raquo;</font>&nbsp" + Request.QueryString["TenLSPChon"]%>
            <% } else { %><font>&raquo;</font>
                  <div itemscope itemtype="http://data-vocabulary.org/Breadcrumb" style="width:30px;  display:inline;">
          <a href="ShowSanPham.aspx?action=advSearch" itemprop="url">
            <span itemprop="title">Sản phẩm</span>
          </a> 
        </div>
              <%} %>
             <%if (Request.QueryString["tenSPChon"] != "" && Request.QueryString["tenSPChon"] != null)
             { %>
               <span itemprop="title"><%="<font>&raquo;</font>&nbsp" + Request.QueryString["tenSPChon"]%>
              <% } %>
          <% } %>
          <%if(Request.QueryString["action"]=="timTheoDanhMuc")
              { %>
                <span itemprop="title"><%=Request.QueryString["LoaiSanPham"] != null ? "<font>&raquo;</font>&nbsp" + Request.QueryString["LoaiSanPham"] : ""%></span>
              <% } %>
        </div>  
    </div>
   
      <asp:DataList ID="dl_products" runat="server" RepeatDirection="Horizontal" RepeatLayout="Table" 
           CellPadding="2" CellSpacing="1" RepeatColumns="3" CaptionAlign="Left" style="float:left; width:606px; margin-left:10px;" >
      <ItemTemplate>
        <div class="border_newproduct">
           
         <div>
           <a href="CTSanPham.aspx?maSanPham=<%#Eval("MaSanPham")%>&<%=Request.QueryString["LoaiSanPham"] != null ? "LoaiSanPham=" + Request.QueryString["LoaiSanPham"] + "&" : ""%><%=Request.QueryString["MaLoaiSanPham"] != null ? "MaLoaiSanPham=" + Request.QueryString["MaLoaiSanPham"] + "&" : ""%><%=Request.QueryString["LSPChon"] != null ? "LSPChon=" + Request.QueryString["LSPChon"] + "&" : ""%><%=Request.QueryString["TenLSPChon"] != null ? "TenLSPChon=" + Request.QueryString["TenLSPChon"] + "&" : ""%><%=Request.QueryString["tenSPChon"] != null ? "tenSPChon=" + Request.QueryString["tenSPChon"] + "&" : ""%><%=Request.QueryString["giaChon"] != null ? "giaChon=" + Request.QueryString["giaChon"] + "&" : ""%><%=Request.QueryString["action"] != null ? "action=" + Request.QueryString["action"].ToString(): "" %>">
             <img src="<%#Eval("CachDung")%>" alt='No Picture' title="Xem chi tiết" style='height:115px; max-width:140px;' />
          </a>
        </div>
        <label >
            <a title="<%#Eval("TenSanPham")%>" href="CTSanPham.aspx?maSanPham=<%#Eval("MaSanPham")%>&<%=Request.QueryString["LoaiSanPham"] != null ? "LoaiSanPham=" + Request.QueryString["LoaiSanPham"] + "&" : ""%><%=Request.QueryString["MaLoaiSanPham"] != null ? "MaLoaiSanPham=" + Request.QueryString["MaLoaiSanPham"] + "&" : ""%><%=Request.QueryString["LSPChon"] != null ? "LSPChon=" + Request.QueryString["LSPChon"] + "&" : ""%><%=Request.QueryString["TenLSPChon"] != null ? "TenLSPChon=" + Request.QueryString["TenLSPChon"] + "&" : ""%><%=Request.QueryString["tenSPChon"] != null ? "tenSPChon=" + Request.QueryString["tenSPChon"] + "&" : ""%><%=Request.QueryString["giaChon"] != null ? "giaChon=" + Request.QueryString["giaChon"] + "&" : ""%><%=Request.QueryString["action"] != null ? "action=" + Request.QueryString["action"].ToString(): "" %>">
               <%#Eval("TenSanPham")%>
            </a>
        </label>
        <span>
            <div> <%#double.Parse(Eval("GiaDaGiam").ToString()) != double.Parse(Eval("GiaBan").ToString()) ? "<font>" + Eval("GiaBan", "{0:#,0.##}") + "&nbsp;VNĐ</font><br/>" : "<span>" + Eval("GiaBan", "{0:#,0.##}") + "&nbsp;VNĐ</span><br/>"%></div>
            <span> <%#double.Parse(Eval("GiaDaGiam").ToString()) == double.Parse(Eval("GiaBan").ToString()) ? "<font></font><br/>" : Eval("GiaDaGiam", "{0:#,0.##}") + "&nbsp;VNĐ"%></span>
        </span>
        <div class="btn_product">
          
            <span  class="form_search_button" style="margin-left:30px;"> 
                <a href="CTSanPham.aspx?maSanPham=<%#Eval("MaSanPham")%>&<%=Request.QueryString["LoaiSanPham"] != null ? "LoaiSanPham=" + Request.QueryString["LoaiSanPham"] + "&" : ""%><%=Request.QueryString["MaLoaiSanPham"] != null ? "MaLoaiSanPham=" + Request.QueryString["MaLoaiSanPham"] + "&" : ""%><%=Request.QueryString["LSPChon"] != null ? "LSPChon=" + Request.QueryString["LSPChon"] + "&" : ""%><%=Request.QueryString["TenLSPChon"] != null ? "TenLSPChon=" + Request.QueryString["TenLSPChon"] + "&" : ""%><%=Request.QueryString["tenSPChon"] != null ? "tenSPChon=" + Request.QueryString["tenSPChon"] + "&" : ""%><%=Request.QueryString["giaChon"] != null ? "giaChon=" + Request.QueryString["giaChon"] + "&" : ""%><%=Request.QueryString["action"] != null ? "action=" + Request.QueryString["action"].ToString(): "" %>" ><%#Eval("CoHang").ToString() =="True" ? "Mua hàng" : "Đặt hàng"%></a>
            </span>
      </div>
     </div> <!--border_newproduct-->

   </ItemTemplate>
 </asp:DataList>
   <!--bắt đầu trang -->
    <div class="paging" style="margin-left:12px;">
     <%int tongSoTrang = Session["tongSoTrang"] != null ? Convert.ToInt32(Session["tongSoTrang"]) : 0;//tongSoTrang có sản phẩm trả về
          for (int i = 1; i <= tongSoTrang; i++)
          { %>
            <a href="ShowSanPham.aspx?<%=Request.QueryString["MaLoaiSanPham"] != null ? "MaLoaiSanPham=" + Request.QueryString["MaLoaiSanPham"] + "&" : ""%><%=Request.QueryString["LSPChon"] != null ? "LSPChon=" + Request.QueryString["LSPChon"] + "&" : ""%><%=Request.QueryString["tenSPChon"] != null ? "tenSPChon=" + Request.QueryString["tenSPChon"] + "&" : ""%><%=Request.QueryString["giaChon"] != null ? "giaChon=" + Request.QueryString["giaChon"] + "&" : ""%>trang=<%= i %>&<%=Request.QueryString["action"] != null ? "action=" + Request.QueryString["action"].ToString(): "" %>"> <span class='page'><%= i %></span></a>
          <%} %>
    </div> 
        <!--kết thúc trang -->
      <!-- End of Main ---------------->
          <%Session.Remove("listSP");
            Session.Remove("tongSoTrang"); %>
  </asp:Content>